package com.hskn.hss.module.tlrepaircfg.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hskn.hss.core.annotation.DataScope;
import com.hskn.hss.core.domain.BaseEntity;
import com.hskn.hss.core.utils.LoginUtils;
import com.hskn.hss.entity.AjaxResult;
import com.hskn.hss.exception.ExcelReaderDataException;
import com.hskn.hss.exception.HssException;
import com.hskn.hss.module.costdict.service.ICostDictService;
import com.hskn.hss.module.costdictitem.entity.CostDictItem;
import com.hskn.hss.module.costdictitem.mapper.CostDictItemMapper;
import com.hskn.hss.module.depart.entity.SysDepart;
import com.hskn.hss.module.depart.mapper.SysDepartMapper;
import com.hskn.hss.module.depart.service.ISysDepartService;
import com.hskn.hss.module.statistics.vo.TlRepairCfgRes;
import com.hskn.hss.module.tlcar.entity.TlCar;
import com.hskn.hss.module.tlcar.mapper.TlCarMapper;
import com.hskn.hss.module.tlcar.service.ITlCarService;
import com.hskn.hss.module.tlcartype.entity.TlCarType;
import com.hskn.hss.module.tlcartype.service.ITlCarTypeService;
import com.hskn.hss.module.tlcostdateil.entity.TlCostDateil;
import com.hskn.hss.module.tlcostdateil.service.ITlCostDateilService;
import com.hskn.hss.module.tlrepaircfg.entity.TlRepairCfg;
import com.hskn.hss.module.tlrepaircfg.mapper.TlRepairCfgMapper;
import com.hskn.hss.module.tlrepaircfg.service.ITlRepairCfgService;
import com.hskn.hss.module.tlrepaircfg.to.TlRepairCfgListTO;
import com.hskn.hss.module.user.entity.User;
import com.hskn.hss.module.user.mapper.UserMapper;
import com.hskn.hss.module.user.service.IUserService;
import com.hskn.hss.module.userdepart.entity.SysUserDepart;
import com.hskn.hss.module.userdepart.mapper.SysUserDepartMapper;
import com.hskn.hss.to.ForIdsTO;
import com.hskn.hss.utils.AttributeUtils;
import com.hskn.hss.utils.GroupingByUtils;
import com.hskn.hss.utils.StringUtils;
import com.hskn.hss.utils.Tools;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Predicate;
import java.util.stream.Collectors;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author hskn
 * @since 2021-05-05
 */
@Service
public class TlRepairCfgServiceImpl extends ServiceImpl<TlRepairCfgMapper, TlRepairCfg> implements ITlRepairCfgService {

    @Resource
    TlRepairCfgMapper TlRepairCfgMapper;
    @Resource
    SysUserDepartMapper sysUserDepartMapper;
    @Resource
    ITlCostDateilService tlCostDateilService;
    @Resource
    TlRepairCfgMapper tlRepairCfgMapper;
    @Resource
    ITlCarService carService;
    @Resource
    ITlCarTypeService carTypeService;
    @Resource
    ISysDepartService departService;
    @Resource
    IUserService userService;
    @Resource
    UserMapper userMapper;
    @Resource
    ICostDictService costDictService;
    @Resource
    CostDictItemMapper costDictItemMapper;
    @Resource
    private SysDepartMapper departMapper;
    @Resource
    private TlCarMapper carMapper;

    @Override
    @Transactional(rollbackFor = {RuntimeException.class, Error.class}) //添加事务
    public AjaxResult insert(JSONObject params) {

        String uid = LoginUtils.getUser().getUid();
        TlRepairCfg tlRepairCfg = params.getObject("data", TlRepairCfg.class);

        QueryWrapper<SysUserDepart> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(SysUserDepart::getUserid, uid);
        String deptid = sysUserDepartMapper.selectOne(queryWrapper).getDepid();

        tlRepairCfg.setCreateby(uid);
        tlRepairCfg.setCreatetime(new Date());
        tlRepairCfg.setId(StringUtils.uuid());
        tlRepairCfg.setDeptid(deptid);
        TlCar car = null;
        if (tlRepairCfg != null) {
            car = carService.getById(tlRepairCfg.getCarnumid());
            tlRepairCfg.setCartype(car.getCartypeid());
            tlRepairCfg.setDeptidforcar(car.getCardeptid());
        }
        int i = TlRepairCfgMapper.insert(tlRepairCfg);

        //添加对应的 明细
        for (TlCostDateil tlCostDateil : tlRepairCfg.getDateils()) {
            tlCostDateil.setId(StringUtils.uuid());
            tlCostDateil.setMaintbid(tlRepairCfg.getId());

            JSONObject dateilParam = new JSONObject().fluentPut("data", tlCostDateil);
            try {
                tlCostDateilService.insert(dateilParam);
            } catch (Exception e) {
                e.printStackTrace();
                log.error("报错ERROR", e);
                return AjaxResult.fail("明细表添加失败，请稍后再试");
            }
        }
        boolean flag = i > 0;

        if (flag) {
            return AjaxResult.success("操作成功");
        } else {
            return AjaxResult.fail("操作失败，请稍后再试");
        }
    }

    @Override
    @Transactional(rollbackFor = {RuntimeException.class, Error.class}) //添加事务
    public AjaxResult update(JSONObject params) throws HssException {

        String uid = LoginUtils.getUser().getUid();
        TlRepairCfg tlRepairCfg = params.getObject("data", TlRepairCfg.class);

        tlRepairCfg.setUpdateby(uid);
        tlRepairCfg.setUpdatetime(new Date());
        TlCar car = null;
        if (tlRepairCfg != null) {
            car = carService.getById(tlRepairCfg.getCarnumid());
            tlRepairCfg.setCartype(car.getCartypeid());
            tlRepairCfg.setDeptidforcar(car.getCardeptid());
        }
        int i = TlRepairCfgMapper.updateById(tlRepairCfg);


        //添加对应的 操作权限
        tlCostDateilService.deleteByMap(tlRepairCfg.getId());
        //添加对应的 明细
        for (TlCostDateil tlCostDateil : tlRepairCfg.getDateils()) {
            tlCostDateil.setId(StringUtils.uuid());
            tlCostDateil.setMaintbid(tlRepairCfg.getId());

            JSONObject dateilParam = new JSONObject().fluentPut("data", tlCostDateil);
            try {
                tlCostDateilService.insert(dateilParam);
            } catch (Exception e) {
                e.printStackTrace();
                log.error("报错ERROR", e);
                return AjaxResult.fail("明细表添加失败，请稍后再试");
            }
        }

        boolean flag = i > 0;
        if (flag) {
            return AjaxResult.success("操作成功");
        } else {
            return AjaxResult.fail("操作失败，请稍后再试");
        }
    }

    @Override
    @Transactional(rollbackFor = {RuntimeException.class, Error.class})
    public AjaxResult deleteByid(ForIdsTO forIdsTO) throws HssException {
        int i = TlRepairCfgMapper.deleteBatchIds(forIdsTO.getIds());
        boolean flag = i > 0;
        if (flag) {
            return AjaxResult.success("操作成功");
        } else {
            return AjaxResult.fail("操作失败，请稍后再试");
        }
    }

    @Override
    public TlRepairCfg getDetailById(JSONObject params) throws HssException {
        String id = params.getString("id");
        TlRepairCfg tlRepairCfg = TlRepairCfgMapper.selectById(id);
        List<TlCostDateil> tlCostDateilList = tlCostDateilService.getitemListByParentId(id);
        if (!tlCostDateilList.isEmpty()) {
            tlRepairCfg.setDateils(tlCostDateilList);
        }
        TlCar car = null;
        TlCarType carType = null;
        SysDepart depart = null;
        User user = null;
        CostDictItem costDictItem = null;
        if (tlRepairCfg != null) {
            car = carService.getById(tlRepairCfg.getCarnumid());
            depart = departService.getById(tlRepairCfg.getDeptid());
            costDictItem = costDictItemMapper.selectById(tlRepairCfg.getRepairreason());
        }
        if (costDictItem != null) {
            tlRepairCfg.setRepairreasonName(costDictItem.getCostname());
        }
        if (car != null) {
            carType = carTypeService.getById(car.getCartypeid());
            user = userService.getById(car.getDriverid());
            tlRepairCfg.setCarCardNum(car.getCarnumber());
        }
        if (carType != null) {
            tlRepairCfg.setCarTyeName(carType.getTypename());
        }
        if (depart != null) {
            tlRepairCfg.setDeptName(depart.getDepartName());
        }
        if (user != null) {
            tlRepairCfg.setDriverName(user.getName());
        }
        if (user != null) {
            tlRepairCfg.setDriverName(user.getName());
        }

        return tlRepairCfg;
    }

    @Override
    @DataScope(deptAlias = "deptIdForCar", userAlias = "creatBy, updateBy")
    public JSONObject getList(BaseEntity entity, JSONObject params) throws HssException {
        Long page = StringUtils.isEmpty(params.getLong("page")) ? 1 : params.getLong("page");
        Long size = StringUtils.isEmpty(params.getLong("size")) ? 10 : params.getLong("size");
        JSONObject json = new JSONObject();

        Map map = new HashMap();
        map.put("carNumid", params.getString("carNumid"));
        map.put("serviceVendorName", params.getString("serviceVendorName"));
        map.put("deptIdForCar", params.getString("deptIdForCar"));
        map.put("orderNo", params.getString("orderNo"));
        map.put("startTime", AttributeUtils.timeCompletion(params.getString("startTime"), 's'));
        map.put("endTime", AttributeUtils.timeCompletion(params.getString("endTime"), 'e'));
        map.put("params", entity.getParams());


        Page<TlRepairCfg> repairPage = new Page<>(page, size, true);
        IPage<TlRepairCfg> iPage = TlRepairCfgMapper.listrepair(repairPage, map);
        List<TlRepairCfg> list = iPage.getRecords();
        Map<String, User> userMap = userService.getUserMap();
        Map<String, TlCar> carMap = carService.getCarMap(new QueryWrapper<>());
        Map<String, SysDepart> departMap = departService.getDepartMap(new QueryWrapper<>());
        Map<String, TlCarType> carTypeMap = carTypeService.getCarTypeMap(new QueryWrapper<>());
        Map<String, CostDictItem> costDictItemMap = costDictService.getitemForCostDictItemMap(new QueryWrapper<>());
        for (TlRepairCfg tlRepairCfg : list) {
            if (carMap != null && carMap.containsKey(tlRepairCfg.getCarnumid())) {
                tlRepairCfg.setCarCardNum(carMap.get(tlRepairCfg.getCarnumid()).getCarnumber());
            }
            if (userMap != null && userMap.containsKey(tlRepairCfg.getDriverid())) {
                tlRepairCfg.setDriverName(userMap.get(tlRepairCfg.getDriverid()).getName());
            }
            if (carTypeMap != null && carTypeMap.containsKey(tlRepairCfg.getCartype())) {
                tlRepairCfg.setCarTyeName(carTypeMap.get(tlRepairCfg.getCartype()).getTypename());
            }
            if (departMap != null && departMap.containsKey(tlRepairCfg.getDeptid())) {
                tlRepairCfg.setDeptName(departMap.get(tlRepairCfg.getDeptid()).getDepartName());
            }
            if (costDictItemMap != null && costDictItemMap.containsKey(tlRepairCfg.getRepairreason())) {
                tlRepairCfg.setRepairreasonName(costDictItemMap.get(tlRepairCfg.getRepairreason()).getCostname());
            }
            if (Objects.nonNull(tlRepairCfg.getCosttime())) {
                tlRepairCfg.setCosttimeString(Tools.getYearMonthDayString(tlRepairCfg.getCosttime()));
            }
        }
        json.put("total", iPage.getTotal());
        json.put("size", iPage.getSize());
        json.put("pages", iPage.getPages());
        json.put("current", iPage.getCurrent());
        json.put("reapairlist", iPage.getRecords());
        return json;
    }

    @Override
    public int getLjwxcs(JSONObject params) throws HssException {
        QueryWrapper<TlRepairCfg> queryWrapper = new QueryWrapper<>();
//        queryWrapper.lambda().eq(TlRepairCfg::getDeptid, 1);
        int json = this.count(queryWrapper);
        return json;
    }

    @Override
    public int getLjwxfy(JSONObject params) throws HssException {
        QueryWrapper<TlRepairCfg> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("sum(totalCost)");
        int json = this.count(queryWrapper);
        return json;
    }

    @Override
    public float getLjlc(JSONObject params) throws HssException {
        QueryWrapper<TlRepairCfg> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("sum(clockMileage)");
        float json = this.count(queryWrapper);
        return json;
    }

    @Override
    public int getDcpjwxcs(JSONObject params) throws HssException {
        QueryWrapper<TlRepairCfg> queryWrapper1 = new QueryWrapper<>();
        queryWrapper1.select("count(id) AS dcwxcs1");
        queryWrapper1.groupBy("carNumid");
        int json1 = this.count(queryWrapper1);
        QueryWrapper<TlRepairCfg> queryWrapper2 = new QueryWrapper<>();
        queryWrapper2.select("distinct carNumid AS dcwxcs2");
        int json2 = this.count(queryWrapper2);
        return (int) Math.ceil((double) json1 / json2);
    }

    @Override
    public int getDcpjwxlcjg(JSONObject params) throws HssException {
        Map map = new HashMap();
        map.put("carNumid", params.getString("carNumid"));
        int json = tlRepairCfgMapper.getDcpjwxlcjg(map);
        return json;
    }

    @Override
    public int getDcpjwsjjg(JSONObject params) throws HssException {
        Map map = new HashMap();
        map.put("carNumid", params.getString("carNumid"));
        int json = tlRepairCfgMapper.getDcpjwsjjg(map);
        return json;
    }

    @Override
    public JSONObject getJgwxtjZwxtjChart(JSONObject params) throws HssException {
        Map map = new HashMap();
        map.put("carNumid", params.getString("carNumid"));
        JSONObject json = new JSONObject();
        List<TlRepairCfgRes> list = tlRepairCfgMapper.getJgwxtjZwxtjChart(map);
        json.put("list", list);
        return json;
    }

    @Override
    public JSONObject getJgwxtjJgwxcspmPjclChart(JSONObject params) throws HssException {
        Map map = new HashMap();
        map.put("carNumid", params.getString("carNumid"));
        JSONObject json = new JSONObject();
        List<TlRepairCfgRes> list = tlRepairCfgMapper.getJgwxtjJgwxcspmPjclChart(map);
        json.put("list", list);
        return json;
    }

    @Override
    public JSONObject getJgwxtjJgwxcspmWxzsChart(JSONObject params) throws HssException {
        Map map = new HashMap();
        map.put("carNumid", params.getString("carNumid"));
        JSONObject json = new JSONObject();
        List<TlRepairCfgRes> list = tlRepairCfgMapper.getJgwxtjJgwxcspmWxzsChart(map);
        json.put("list", list);
        return json;
    }

    @Override
    public JSONObject getJgwxtjJgwxfypmPjclChart(JSONObject params) throws HssException {
        Map map = new HashMap();
        map.put("carNumid", params.getString("carNumid"));
        JSONObject json = new JSONObject();
        List<TlRepairCfgRes> list = tlRepairCfgMapper.getJgwxtjJgwxfypmPjclChart(map);
        json.put("list", list);
        return json;
    }

    @Override
    public JSONObject getJgwxtjJgwxfypmWxzsChart(JSONObject params) throws HssException {
        Map map = new HashMap();
        map.put("carNumid", params.getString("carNumid"));
        JSONObject json = new JSONObject();
        List<TlRepairCfgRes> list = tlRepairCfgMapper.getJgwxtjJgwxfypmWxzsChart(map);
        json.put("list", list);
        return json;
    }

    @Override
    public JSONObject getJgwxtjClwxfbZydlfbCsChart(JSONObject params) throws HssException {
        Map map = new HashMap();
        map.put("carNumid", params.getString("carNumid"));
        JSONObject json = new JSONObject();
        List<TlRepairCfgRes> list = tlRepairCfgMapper.getJgwxtjClwxfbZydlfbCsChart(map);
        json.put("list", list);
        return json;
    }

    @Override
    public JSONObject getJgwxtjClwxfbCllxfbCsChart(JSONObject params) throws HssException {
        Map map = new HashMap();
        map.put("carNumid", params.getString("carNumid"));
        JSONObject json = new JSONObject();
        List<TlRepairCfgRes> list = tlRepairCfgMapper.getJgwxtjClwxfbCllxfbCsChart(map);
        json.put("list", list);
        return json;
    }

    @Override
    public JSONObject getJgwxtjClwxfbClfbCsChart(JSONObject params) throws HssException {
        Map map = new HashMap();
        map.put("carNumid", params.getString("carNumid"));
        JSONObject json = new JSONObject();
        List<TlRepairCfgRes> list = tlRepairCfgMapper.getJgwxtjClwxfbClfbCsChart(map);
        json.put("list", list);
        return json;
    }

    @Override
    public JSONObject getJgwxtjClwxfbZydlfbFyChart(JSONObject params) throws HssException {
        Map map = new HashMap();
        map.put("carNumid", params.getString("carNumid"));
        JSONObject json = new JSONObject();
        List<TlRepairCfgRes> list = tlRepairCfgMapper.getJgwxtjClwxfbZydlfbFyChart(map);
        json.put("list", list);
        return json;
    }

    @Override
    public JSONObject getJgwxtjClwxfbCllxfbFyChart(JSONObject params) throws HssException {
        Map map = new HashMap();
        map.put("carNumid", params.getString("carNumid"));
        JSONObject json = new JSONObject();
        List<TlRepairCfgRes> list = tlRepairCfgMapper.getJgwxtjClwxfbCllxfbFyChart(map);
        json.put("list", list);
        return json;
    }

    @Override
    public JSONObject getJgwxtjClwxfbClfbFyChart(JSONObject params) throws HssException {
        Map map = new HashMap();
        map.put("carNumid", params.getString("carNumid"));
        JSONObject json = new JSONObject();
        List<TlRepairCfgRes> list = tlRepairCfgMapper.getJgwxtjClwxfbClfbFyChart(map);
        json.put("list", list);
        return json;
    }

    @Override
    @DataScope(deptAlias = "deptidforcar", userAlias = "creatBy")
    public List<TlRepairCfg> getTlRepairCfgList(TlRepairCfgListTO repairCfgListTO, SimpleDateFormat format) throws ParseException {
        //查询数据
        QueryWrapper<TlRepairCfg> inspectionCfgQueryWrapper = new QueryWrapper<>();
        if (StringUtils.isNotEmpty(repairCfgListTO.getDeptid())) {
            inspectionCfgQueryWrapper.lambda().eq(TlRepairCfg::getDeptid, repairCfgListTO.getDeptid());
        }
        if (StringUtils.isNotEmpty(repairCfgListTO.getCarNumid())) {
            inspectionCfgQueryWrapper.lambda().eq(TlRepairCfg::getCarnumid, repairCfgListTO.getCarNumid());
        }
        if (repairCfgListTO.getParams().containsKey("dataScope") && StringUtils.isNotEmpty(repairCfgListTO.getParams().get("dataScope").toString())) {
            inspectionCfgQueryWrapper.lambda().apply(repairCfgListTO.getParams().get("dataScope").toString());
        }
        if (StringUtils.isNotEmpty(repairCfgListTO.getRepairOddNumbers())) {
            inspectionCfgQueryWrapper.lambda().eq(TlRepairCfg::getOrderno, repairCfgListTO.getRepairOddNumbers());
        }
        if (repairCfgListTO.getIds() != null && !repairCfgListTO.getIds().isEmpty()) {
            inspectionCfgQueryWrapper.lambda().in(TlRepairCfg::getId, repairCfgListTO.getIds());
        }
        if (StringUtils.isNotEmpty(repairCfgListTO.getStartTime()) && StringUtils.isNotEmpty(repairCfgListTO.getEndTime())) {
            inspectionCfgQueryWrapper.lambda().ge(TlRepairCfg::getCosttime, format.parse(repairCfgListTO.getStartTime()));
            inspectionCfgQueryWrapper.lambda().le(TlRepairCfg::getCosttime, format.parse(repairCfgListTO.getEndTime()));
        }
        List<TlRepairCfg> repairCfgList = tlRepairCfgMapper.selectList(inspectionCfgQueryWrapper);
        return repairCfgList;
    }

    @Override
    public void excelReader(List<TlRepairCfg> repairCfgList) throws ExcelReaderDataException {

        String uid = LoginUtils.getUser().getUid();
        List<SysDepart> departList = departMapper.selectList(new QueryWrapper<>());
        List<TlCar> carList = carMapper.selectList(new QueryWrapper<>());
        List<CostDictItem> costDictItemList = costDictItemMapper.selectList(new QueryWrapper<>());
        Map<String, TlCar> carMap = new HashMap<>();
        if (!carList.isEmpty()) {
            carMap = carList.stream().collect(Collectors.groupingBy(TlCar::getCarnumber, Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0))));
        }
        Map<String, SysDepart> departMap = new HashMap<>();
        if (!departList.isEmpty()) {
            Predicate<SysDepart> departNameNotNull = depart -> StringUtils.isNotEmpty(depart.getDepartName());
            departList = departList.stream().filter(departNameNotNull).collect(Collectors.toList());
            departMap = GroupingByUtils.getGroupingForMapEntity(departList, SysDepart::getDepartName, Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0)));
        }
        Map<String, CostDictItem> costDictItemMap = new HashMap<>();
        if (!costDictItemList.isEmpty()) {
            Predicate<CostDictItem> nameNotNull = costDictItem -> StringUtils.isNotEmpty(costDictItem.getCostname());
            costDictItemList = costDictItemList.stream().filter(nameNotNull).collect(Collectors.toList());
            costDictItemMap = GroupingByUtils.getGroupingForMapEntity(costDictItemList, CostDictItem::getCostname, Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0)));
        }
        Map<String, User> userMap = new HashMap<>();
        List<User> userList = userMapper.selectList(new QueryWrapper<>());
        userMap = GroupingByUtils.getGroupingForMapEntity(userList, User::getName, Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0)));
        int num = 1;
        String str = "";
        for (TlRepairCfg repairCfg : repairCfgList) {
            repairCfg.setCreatetime(new Date());
            repairCfg.setCreateby(uid);
            if (departMap.containsKey(repairCfg.getDeptName())) {
                repairCfg.setDeptid(departMap.get(repairCfg.getDeptName()).getId());
                repairCfg.setDeptidforcar(departMap.get(repairCfg.getDeptName()).getId());
            } else {
                str += "第" + num + "条的" + "“‘" + "所属机构’:‘" + repairCfg.getDeptName() + "’”" + "不存在;##";
            }
            if (StringUtils.isNotEmpty(repairCfg.getCarCardNum())) {
                if (carMap.containsKey(repairCfg.getCarCardNum())) {
                    repairCfg.setCarnumid(carMap.get(repairCfg.getCarCardNum()).getId());
                } else {
                    str += "第" + num + "条的" + "“‘" + "车牌号’:‘" + repairCfg.getCarCardNum() + "’”" + "不存在;##";
                }
            } else {
                str += "第" + num + "条的“车牌号”不能为空;##";
            }
            if (Objects.isNull(repairCfg.getCosttime())) {
                str += "第" + num + "条的’维修时间‘时间格式不正确;##";
            }
            if (Objects.isNull(repairCfg.getTotalcost())) {
                str += "第" + num + "条的“总费用”不能为空;##";
            }
            if (costDictItemMap.containsKey(repairCfg.getRepairreasonName())) {
                repairCfg.setRepairreason(costDictItemMap.get(repairCfg.getRepairreasonName()).getId());
            } else {
                str += "第" + num + "条的" + "“‘" + "维修部位’:‘" + repairCfg.getRepairreasonName() + "’”" + "不存在;##";
            }
            if (!userMap.containsKey(repairCfg.getPayusername())) {
                str += "第" + num + "条的" + "“‘" + "缴费人’:‘" + repairCfg.getPayusername() + "’”" + "不存在;##";
            }
            num++;
        }
        if (StringUtils.isNotEmpty(str)) {
            throw new ExcelReaderDataException("您导入的数据:##" + str);
        }
    }
}
